/**
* ThinkPHP
* lnkAdmin is committed to providing solutions for quickly building web applications
* Please view the LICENSE file that was distributed with this source code,
* For the full copyright and license information.
* Thank you very much for using lnkAdmin.
*
* @Author Dengje
* @Link   https://gitee.com/dengje/lnkAdmin
*/


<template>
  <el-popover trigger="focus" :width="256">
    <template #reference>
      <el-button :icon="modelValue">{{ modelValue }}</el-button>
    </template>
    <div class="el-icon-picker">
      <component v-for="icon in icons" :key="icon"
        :class="[icon, 'icon', { 'icon-active': icon == modelValue }]"
        :is="icon"
        @click="select(icon)">
      </component>
    </div>
  </el-popover>
</template>
<script>
import { getCurrentInstance } from 'vue'

export default {
    name: "laIconPicker",
    props: {
      modelValue:String,
      disabled:Boolean 
    },
    data() {
    return {
      icons:[],
    }},
    created(){
      const { proxy } = getCurrentInstance()
      this.icons = proxy.$icons;
    },
    methods:{
      select(icon){
        this.$emit('update:modelValue',icon)
      }
    },
    computed: {
      
    }
  };

</script>
<style scoped>
.el-icon-picker {
  height: 256px;
  overflow-y: scroll;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

.icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  color: var(--el-text-color-regular);
  font-size: 20px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  line-height: 45px;
  margin: 5px;
}

.icon:hover {
  color: var(--el-color-primary);
}

.icon-active {
  color: var(--el-color-primary);
}
</style>

